home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
vbchat1a
/
chat.frm
next >
Wrap
Text File
|
1999-08-30
|
10KB
|
363 lines
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.MDIForm MDIForm1
BackColor = &H8000000C&
Caption = "Vb chat"
ClientHeight = 5055
ClientLeft = 165
ClientTop = 735
ClientWidth = 7080
LinkTopic = "MDIForm1"
StartUpPosition = 3 'Windows Default
WindowState = 2 'Maximized
Begin VB.PictureBox Picture3
Align = 2 'Align Bottom
BorderStyle = 0 'None
Height = 360
Left = 0
ScaleHeight = 360
ScaleWidth = 7080
TabIndex = 5
Top = 4695
Width = 7080
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 135
Left = 1560
TabIndex = 6
Top = 120
Width = 2655
_ExtentX = 4683
_ExtentY = 238
_Version = 393216
Appearance = 0
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Mostafa Mohamed web page"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 195
Left = 4320
MouseIcon = "chat.frx":0000
MousePointer = 99 'Custom
TabIndex = 8
Top = 90
Width = 2070
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Sending progress:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 120
TabIndex = 7
Top = 60
Width = 1275
End
End
Begin VB.Timer Timer2
Interval = 1
Left = 1680
Top = 0
End
Begin VB.Timer Timer1
Interval = 1000
Left = 1320
Top = 0
End
Begin MSWinsockLib.Winsock sck
Left = 960
Top = 0
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin VB.PictureBox Picture2
Align = 1 'Align Top
BorderStyle = 0 'None
Height = 495
Left = 0
ScaleHeight = 495
ScaleWidth = 7080
TabIndex = 3
Top = 0
Width = 7080
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Index = 0
Left = 0
Picture = "chat.frx":0152
Style = 1 'Graphical
TabIndex = 4
Top = 0
Visible = 0 'False
Width = 975
End
End
Begin VB.PictureBox Picture1
Align = 4 'Align Right
BorderStyle = 0 'None
Height = 4200
Left = 4785
ScaleHeight = 4200
ScaleWidth = 2295
TabIndex = 0
Top = 495
Width = 2295
Begin VB.ListBox List1
Enabled = 0 'False
Height = 4155
ItemData = "chat.frx":0494
Left = 0
List = "chat.frx":0496
TabIndex = 1
Top = 360
Width = 2295
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Available users:-"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 120
TabIndex = 2
Top = 120
Width = 1155
End
End
Begin VB.Menu mnufile
Caption = "File"
Begin VB.Menu mnuconnect
Caption = "Connect"
End
Begin VB.Menu mnuexit
Caption = "Exit"
End
End
End
Attribute VB_Name = "MDIForm1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim lastindex As Integer
Dim tex As String
Private Sub Command1_Click(Index As Integer)
On Error Resume Next
Form1.Picture1(Index).Visible = True
Form1.Picture1(Index).ZOrder 0
End Sub
Private Sub Label3_Click()
On Error Resume Next
Shell "explorer http://www.geocities.com/ResearchTriangle/Campus/4598/", vbNormalFocus
End Sub
Private Sub List1_Click()
On Error Resume Next
Load Command1(List1.ListIndex)
Command1(List1.ListIndex).Visible = True
Command1(List1.ListIndex).Left = 0
Command1(List1.ListIndex).Top = 0
Command1(List1.ListIndex).Caption = List1.List(List1.ListIndex)
lastindex = List1.ListIndex
Form1.loadfrm List1.ListIndex
Form1.Label1(List1.ListIndex).Caption = List1.List(List1.ListIndex)
End Sub
Private Sub MDIForm_Load()
lastindex = 0
End Sub
Private Sub MDIForm_Unload(Cancel As Integer)
On Error Resume Next
sck.SendData "closed=>:" & user.Nickname
Picture2.Visible = False
Unload Form1
List1.Enabled = False
sck.Close
End Sub
Private Sub mnuconnect_Click()
On Error Resume Next
If mnuconnect.Caption = "Connect" Then
sck.Close
Form1.Show
List1.Clear
frmLogin.Show vbModal
mnuconnect.Caption = "Disconnect"
Picture2.Visible = True
List1.Enabled = True
Exit Sub
Else
sck.SendData "closed=>:" & user.Nickname
mnuconnect.Caption = "Connect"
Picture2.Visible = False
Unload Form1
List1.Enabled = False
Exit Sub
End If
End Sub
Private Sub mnuexit_Click()
On Error Resume Next
sck.SendData "closed=>:" & user.Nickname
Picture2.Visible = False
Unload Form1
List1.Enabled = False
sck.Close
End
End Sub
Private Sub Picture1_Resize()
List1.Height = Picture1.ScaleHeight - List1.Top
End Sub
Private Sub sck_Connect()
On Error Resume Next
MDIForm1.sck.SendData "adduser" & "=>:" & user.Name & "=>:" & user.Nickname & "=>:" & user.ip
End Sub
Private Sub sck_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next
Dim start As Integer
Dim str As String
Dim res As VbMsgBoxResult
Dim splited() As String
Dim arriveddata As String
Dim start2 As Integer
sck.GetData arriveddata, vbString
DoEvents
start = 1
DoEvents
Do
chrpos = InStr(start, arriveddata, "|", vbTextCompare)
start2 = start
X = chrpos
start = chrpos + 1
If chrpos <> 1 Then
If chrpos <> 0 Then
str = Mid(arriveddata, start2, chrpos - start2)
splited() = Split(str, "=>:")
If str <> "" Then
'-------------------